package com.todo.delicacy.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/17 21:25
 * @description
 */
@Getter
@AllArgsConstructor
public enum FoodTypeEnum {

    SNACK(1, "SNACK", "小吃"),
    STIR_FRY(2, "FOOD", "炒菜"),
    HOT_POT(3, "HOT_POT", "火锅"),
    BARBECUE(4, "BARBECUE", "烧烤"),
    NOODLE_PASTRY(5, "NOODLE_PASTRY", "面食"),
    LOCAL_CUISINE(6, "LOCAL_CUISINE", "地方美食"),
    FOREIGN_CUISINE(7, "FOREIGN_CUISINE", "西餐"),
    CUSTOM(8, "CUSTOM", "自定义美食"),

    ;

    private static Map<Integer, FoodTypeEnum> typeMap = Arrays
            .stream(FoodTypeEnum.values())
            .collect(Collectors.toMap(FoodTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static FoodTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
